home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / s48.zip / MAKEFILE < prev    next >
Text File  |  1992-06-18  |  5KB  |  175 lines

  1. # Scheme48 Makefile
  2. # Last updated May 1992 by JAR
  3.  
  4. # Due to a bug ("limitation") in many implementations of the Unix
  5. # kernel's shell script execution feature (#! at the beginning of an
  6. # exec'ed file), the length of the string produced by $(BIN)/$(VM)
  7. # should be <= 27 characters in order for the "install_method_1"
  8. # target to work.  If $(BIN)/$(VM) is too long, or this feature is
  9. # unsupported, then change INSTALL_TARGET to be "install_method_2"
  10. # instead of "install_method_1".
  11.  
  12. # Set the following variables as appropriate for your site.
  13.  
  14. BIN = /usr/u/jar/bin
  15. LIB = /usr/u/jar/lib
  16. MAN = /usr/u/jar/man/man1
  17. DISTDIR = /usr/spool/ftp/pub/jar
  18. RUNNABLE = s48
  19. INSTALL_METHOD = install_method_1
  20. CC = gcc
  21.  
  22. # Avoid changing anything below this point, except MOREFILES, which
  23. # you might want to change to make the default image have more or less
  24. # stuff in it.
  25.  
  26. CFLAGS = -O2 -g
  27. SUBMAKEFILE = Makefile.filenames
  28. include $(SUBMAKEFILE)
  29.  
  30. MOREFILES = $(EXTRAFILES)
  31.  
  32. # Sources: (IMAGE is also a target)
  33.  
  34. CFILES = main.c unix.c error.c extension.c scheme48vm.c
  35. FILES_FILE = files.scm
  36. IMAGE = scheme48.image
  37.  
  38. # DISTFILES should include all sources.
  39.  
  40. DISTFILES = COPYING README INSTALL Makefile NEWS TODO user-guide.txt \
  41.         $(SUBMAKEFILE) $(CFILES) $(IMAGE) $(FILES_FILE) $(ALLFILES) \
  42.         scheme48.man
  43.  
  44. # Targets:
  45.  
  46. VM = scheme48vm
  47. OBJFILES = main.o unix.o error.o extension.o scheme48vm.o
  48. LINKER_IMAGE = boot/linker.image
  49. SYSTEM_IMAGE = boot/system.image
  50.  
  51. # Make's default target will be the VM only, not the image.  We can't
  52. # make a new image unless we already have an installed scheme48 (i.e.
  53. # RUNNABLE).
  54.  
  55. $(VM): $(OBJFILES)
  56.     $(CC) -o $(VM) $(OBJFILES)
  57.  
  58. # The linker is capable of rebuilding an image from sources, even
  59. # across an incompatible change in VM data representations.
  60. # The :bench command here turns benchmark mode on.
  61.  
  62. $(LINKER_IMAGE) : $(COMPILERFILES) $(LINKERFILES)
  63.     (echo :batch;                 \
  64.      echo :bench;              \
  65.      echo :load $(FILES_FILE);    \
  66.      echo "(load-linker)";          \
  67.      echo :undefined;          \
  68.      echo :dump $(LINKER_IMAGE))  \
  69.     | $(RUNNABLE)
  70.  
  71. # Use the linker to build a new Scheme48 system image ("rts").
  72.  
  73. $(SYSTEM_IMAGE) : $(LINKER_IMAGE) $(RTSFILES)
  74.     (echo :batch;                 \
  75.      echo :load $(FILES_FILE);    \
  76.      echo "(link-system)")          \
  77.     | $(RUNNABLE) -i $(LINKER_IMAGE)
  78.  
  79. # The double $ in the following causes make to pass a single $ on to sh.
  80. # Filename boot/system.debug shouldn't be hard-wired!
  81. # The :bench command here turns benchmark mode off.
  82.  
  83. $(IMAGE): $(VM) $(SYSTEM_IMAGE) $(MOREFILES)
  84.     (echo :load $(MOREFILES);     \
  85.      echo "(command-processor 'batch)";          \
  86.      echo "(read-debug-info \"boot/system.debug\")"; \
  87.      echo "(keep-debug-data! 'maps #t)"; \
  88.      echo "(keep-debug-data! 'source #t)"; \
  89.      echo :bench;              \
  90.      echo :disable;              \
  91.      echo :identify-image \"\(made by $$USER on `date`\)\"; \
  92.      echo :dump $(IMAGE))         \
  93.     | ./$(VM) -i $(SYSTEM_IMAGE)
  94.  
  95. main.o: main.c
  96.     $(CC) $(CFLAGS) -c -DDEFAULT_IMAGE_NAME=\"$(BIN)/$(RUNNABLE)\" main.c
  97.  
  98. $(SUBMAKEFILE): $(FILES_FILE)
  99.     (echo :batch; \
  100.      echo :load $(FILES_FILE); \
  101.      echo "(write-makefile \"$(SUBMAKEFILE)\")") \
  102.     | $(RUNNABLE)
  103.  
  104. $(RUNNABLE).1: scheme48.man Makefile
  105.     sed 's=LBIN=$(BIN)=g' scheme48.man \
  106.     | sed 's=LLIB=$(BIN)=g' \
  107.     | sed 's=LS48=$(RUNNABLE)=g' >$@
  108.  
  109. $(DISTDIR)/s48.tar.Z: $(DISTFILES)
  110.     tar cf - $(DISTFILES) \
  111.     | compress -c >$(DISTDIR)/s48.tar.Z
  112.  
  113. # This fake target is for making a new system.image quickly (but
  114. # "incestuously").  This doesn't rely on the linker image.
  115. # You'll probably want to follow a "make quickly" with
  116. # "make scheme48.image".
  117.  
  118. quickly: $(QUICKLYFILES) $(RTSFILES)
  119.     (echo :batch; \
  120.      echo :load $(FILES_FILE); \
  121.      echo "(for-each load-file quickly-files)"; \
  122.      echo "(link-system)") \
  123.     | $(RUNNABLE)
  124.  
  125. boot/testsys.image: boot/testsys.scm $(LINKER_IMAGE)
  126.     (echo :batch; \
  127.      echo "(define testsys";\
  128.      echo "  (make-system '(\"boot/testsys.scm\") 'resume #f))"; \
  129.      echo "(write-system testsys \"boot/testsys.image\")") \
  130.     | $(RUNNABLE) -i $(LINKER_IMAGE)
  131.  
  132. boot/little.image: boot/little.scm $(LINKER_IMAGE)
  133.     (echo :batch; \
  134.      echo "(link-little)") \
  135.     | $(RUNNABLE) -i $(LINKER_IMAGE)
  136.  
  137.  
  138.  
  139. # Big kludge (p- means Pseudoscheme)
  140.  
  141. p-files.scm: files.scm
  142.     sed -e "s= s48-= p-=" <files.scm >p-files.scm
  143. t-files.scm: files.scm
  144.     sed -e "s= s48-= t-=" <files.scm >t-files.scm
  145.  
  146.  
  147. # Fake targets:  all clean install man dist
  148.  
  149. all: $(SUBMAKEFILE) $(VM) $(IMAGE)
  150.  
  151. clean:
  152.     -rm -f $(VM) *.o *.1 boot/*.image boot/*.debug TAGS
  153.  
  154. install: $(VM) $(INSTALL_METHOD) $(RUNNABLE).1
  155.     cp $(VM) $(BIN)/
  156.     chmod +x $(BIN)/$(RUNNABLE)
  157.     cp $(RUNNABLE).1 $(MAN)/
  158.     chmod +r $(MAN)/$(RUNNABLE).1
  159.  
  160. install_method_1:
  161.     (echo '#!$(BIN)/$(VM)' -i; cat $(IMAGE)) >$(BIN)/$(RUNNABLE)
  162.  
  163. install_method_2:
  164.     cp $(IMAGE) $(LIB)/$(IMAGE)
  165.     (echo '#!/bin/sh'; \
  166.      echo exec '$(BIN)/$(VM)' -i '$(LIB)/$(IMAGE) "$$@"') \
  167.        > $(BIN)/$(RUNNABLE)
  168.  
  169. man:    $(RUNNABLE).1
  170.  
  171. dist: $(DISTDIR)/s48.tar.Z
  172.  
  173. tags:
  174.     etags rts/*.scm misc/*.scm
  175.